<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
						<input id="id" name="id" th:value="${publish.id}"  type="hidden">
							<div class="form-group">
								<label class="col-sm-3 control-label">标题：</label>
								<div class="col-sm-8" >
									<input id="title" disabled name="title" th:value="${publish.title}" class="form-control" type="text">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">部门：</label>
								<div class="col-sm-8">
									<input id="createDeptName" disabled name="createDeptName" th:value="${publish.createDeptName}" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">发布人：</label>
								<div class="col-sm-8">
									<input id="createName" name="createName" th:value="${publish.createName}" class="form-control" type="text" disabled>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">首页显示：</label>
								<div class="col-sm-8">

									<input  type="radio" name="showIndex" th:value="${dictDO.name}"   class="form-control" type="text" disabled/>

								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">类型：</label>
								<div class="col-sm-8">
									<input id="typeName" name="typeName" th:value="${publish.typeName}" class="form-control" type="text" disabled>
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">内容：</label>
								<div class="col-sm-8" th:utext="${publish.content}" style="line-height: 34px;">
									<!--<textarea id="content" disabled="disabled" name="content" th:text="${publish.content}" class="form-control summernote" rows="5"></textarea>-->
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">创建时间：</label>
								<div class="col-sm-8">
									<input id="createDate" disabled name="createDate" th:value="${#dates.format(publish.createDate,'yyyy-MM-dd HH:mm:ss')}" class="form-control" type="text">
								</div>
							</div>
							<div class="form-group layui-upload">
								<label class="col-sm-3 control-label">附件上传：</label>
								<div class="col-sm-8">
									<!--<button type="button" class="btn btn-success" id="btnUpload"><i class="fa fa-cloud"></i> 选择文件</button>-->
									<div class="layui-upload-lis">
										<table class="layui-table">
											<thead>
											<tr>
												<th>文件名</th>
												<th>大小</th>
												<th>状态</th>
												<th style="width:100px;">操作</th>
											</tr>
											</thead>
											<tbody id="demoList" th:each="hnzkFiles:${hnzkFiles}"  >
											<tr>
												<td th:text="${hnzkFiles.fileName}"></td>
												<td th:text="${(hnzkFiles.fileSize/1024.0/1024.0)<1 ? #numbers.formatDecimal(hnzkFiles.fileSize/1024.0,0,2)+'KB' : #numbers.formatDecimal(hnzkFiles.fileSize/1024.0/1024.0,0,2)+'MB'}">大小</td>
												<td >已上传</td>
												<td>
													<!--<button type="button" class="btn btn-xs btn btn-danger" onclick="deleteFile(this);" th:id="${hnzkFiles.id}">删除</button>-->
													<button type="button" class="btn btn-xs btn btn-primary " onclick="download(this);" th:id="${hnzkFiles.id}">下载</button>
												</td>
											</tr>
											</tbody>

										</table>
									</div>
									<!--<button type="button" class="btn  btn-primary" id="testListAction">开始上传</button>-->
									<input id="affixId" name="affixId" class="form-control" type="hidden" th:value="${publish.affixId}">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">审批意见：</label>
								<div class="col-sm-8" th:utext="${publish.approvalMessage}" style="line-height: 34px;"> </div>
							</div>

							<div class="form-group">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="button" class="btn closeBtn" onclick="myClose();">关闭</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
	</div>
	</div>
	<div th:include="include::footer"></div>
	<!--<script type="text/javascript" src="/js/appjs/hnzk/publish/edit.js">
	</script>-->
	<script type="text/javascript">
		function myClose(){
			var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
			parent.layer.close(index); //再执行关闭

		}
		function deleteFile(e) {
			var fid = $(e).attr("id");
			console.info("fid:"+fid);
			$.ajax({
				url : "/hnzk/file/removeFile",
				type : "post",
				data : {
					'id' : fid
				},
				success : function(r) {
					if (r.code==0) {
						layer.msg(r.msg);
						$(e).parent().parent().remove();
					}else{
						layer.msg(r.msg);
					}
				}

			})
		}


		function download(e) {
			var fid = $(e).attr("id")
			window.open("/hnzk/file/download?id="+fid);

		}

	</script>
</body>
</html>
